<template>
  <RouterView v-slot="{ Component }">
    <KeepAlive :include="includes">
      <component :is="Component" />
    </KeepAlive>
  </RouterView>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()

// 计算 includes
const includes = router
  .getRoutes()
  .filter((route) => route.meta.keepAlive)
  .map((item) => item.name!) as string[]
</script>

<style>
@import './global.css';
</style>
